//
//  EFengOrganizationDepCell.m
//  WZEfengAndEtong
//
//  Created by wanzhao on 16/2/16.
//  Copyright © 2016年 wanzhao. All rights reserved.
//

#import "EFengOrganizationDepCell.h"

@interface EFengOrganizationDepCell ()

WeakProperty UIView *rightLine;
WeakProperty UIView *backView;

WeakProperty UIView *downLine;
@end

@implementation EFengOrganizationDepCell


+ (instancetype)eFengOrganizationDepcellWithtableview:(UITableView *)tableView
{
    static NSString *depCell = @"depCell";
    EFengOrganizationDepCell *cell = [tableView dequeueReusableCellWithIdentifier:depCell];
    if (cell == nil) {
        cell = [[EFengOrganizationDepCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:depCell];
        cell.textLabel.textAlignment = UITextAlignmentCenter;
        
    }
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
//        UIView *line = [[UIView alloc] init];
//        line.backgroundColor = RGBCOLOR(212, 212, 212);
//        [self.contentView addSubview:line];
//        line.hidden = NO;
//        self.rightLine = line;
        
        
        UIView *line1 = [[UIView alloc] init];
        line1.backgroundColor = RGBCOLORWITH16COLOR(0xe5e5e5);
        [self.contentView addSubview:line1];
        line1.hidden = NO;
        self.downLine = line1;

        self.textLabel.font = Font14;
        
//        UIView *backView = [[UIView alloc] init];
//        backView.backgroundColor = [UIColor lightGrayColor];
//        [self.contentView addSubview:backView];
//        self.backView = backView;
//        backView.hidden = YES;
        
        
    }
    return self;
}

- (void)setIsCellSelected:(BOOL)isCellSelected
{
//    _isCellSelected = isCellSelected;
//    
//    self.rightLine.hidden = isCellSelected;
    if (isCellSelected) {
        self.textLabel.textColor = RGBCOLORWITH16COLOR(0xfb5d44);
        self.backgroundColor = [UIColor whiteColor];
        self.downLine.hidden = YES;
    } else {
        self.textLabel.textColor = RGBCOLORWITH16COLOR(0x818181);
        self.backgroundColor = RGBCOLORWITH16COLOR(0xe7f5ff);
        self.downLine.hidden = NO;
    }
    
}

- (void)layoutSubviews
{
    [super layoutSubviews];
//    self.rightLine.frame = CGRectMake(self.width - 0.5f, 0, 0.5f, self.height);
    self.downLine.frame = CGRectMake(20, self.height - 0.5f, self.width-40, 0.5f);
}
@end
